package com.yigo.framework.util;

import org.springframework.context.support.ReloadableResourceBundleMessageSource;

import java.util.*;

public class I18nUtil {
    private static final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();

    static {
        source.setCacheSeconds(60);
        source.setDefaultLocale(Locale.CHINA);
        source.setDefaultEncoding("utf-8");
    }

    public static String getMsg(Locale locale, String baseName, String code, Object... args) {
        source.addBasenames(baseName);
        return source.getMessage(code, args, locale);
    }
}
